<template>
	<view class="content">
		<!-- <header-common title="首页" :iconShow="false"></header-common> -->
		<common-search :show="false"></common-search>
		<!-- <image class="logo" src="/static/logo.png"></image> -->
		<!-- <view class="text-area">
			<text class="title">{{title}}</text>
		</view> -->
		
		<button @click="navTo('/pages/login/login')">跳转</button>
		<button @click="navTo('/pages/details/details')">跳转2</button>
		<button @click="navTo('/pages/temp/temp')">跳转temp</button>


		<myList :list="list"></myList>

		<tabbar :index="0"></tabbar>
	</view>
</template>

<script>
	import {
		line_items
	} from "@/api/axios.js"
	export default {
		data() {
			return {
				list: [],
				page: 1,
			}
		},
		async onLoad(option) {
			// console.log(option);
			this.getList();

		},

		methods: {
			navTo(url) {
				uni.navigateTo({
					url
				})
			},
			async getList() {
				let res = await line_items({
					page: this.page,
				})

				this.list = [...this.list, ...res]

				// if (res.data != null && res.data.length > 0) {
				// 	this.page++;
				// 	for (var i = 0; i < res.data.length; i++) {
				// 		this.list.push(res.data[i])
				// 	}
				// }
			},

		},
		// 触底加载列表
		async onReachBottom() {
			uni.showLoading({
				title: '加载中'
			});
			await this.getList();
			uni.hideLoading();
		},
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}

	.uni-app--showleftwindow+.uni-tabbar-bottom {
		display: none;
	}
</style>